

module fcgi.test ;

import std.path;
import std.file;
import std.exception;
import std.c.stdlib;
import core.memory;
import std.traits;
import std.datetime;
import std.process;
import core.memory;

import fcgi.jtype, fcgi.tpl;


void main(string[] argv) {

	//GC.disable;
	Tpl_Factory tf;
	tf.Init;

	StopWatch sw;
	sw.start;
	auto user_list	= tf.create("UserList", "test.tpl") ;
	sw.stop;
	log(" use time=", sw.peek.msecs, "ms" );
	
	sw.reset;
	sw.start;
	scope(exit){
		sw.stop;
		log(" use time=", sw.peek.msecs, "ms" );
		user_list.clear;
	}
	
	auto v1	= new V1;
	
	user_list.assign(v1, "var1");
	
	V1[3] v2;
	foreach(int i, ref _v;v2) _v = new V1;
	user_list.assign(v2, "v2");
	
	
	auto vv2 = new V2;
	user_list.assign(vv2, "vv2");
	
	user_list.assign(argv, "argv");
	
	user_list.assign(environment.toAA, "env");
	user_list.render;
	log("", user_list.buffer);
}


class V1 {
	long v1_i = 123 ;
	string v1_v1 = "Test 123" ;
	string v1_x1 = "321";
}


struct V2 {
	long v2i = 1234444 ;
	string v1 = "V2.v1.string" ;
	private string x1 = "V2 x1";
}